<?php
//Include DB Connection
include '..'.DIRECTORY_SEPARATOR.'db-connection'.DIRECTORY_SEPARATOR.'conn.php';

$category = addslashes($_REQUEST['categoryname']);
$sql = "SELECT b.id, b.subcat_name FROM tbl_category_mst a, tbl_subcategory_mst b, tbl_category_subcategory_map c
		WHERE 
		a.id=c.category_id AND 
		b.id = c.subcategory_id AND 
		a.is_active='Y' AND a.category_name='$category'";
		file_put_contents("Log_test_db-insert.php", $sql);
		$run = mysql_query($sql);
		$counter=0;
		
		$data .='<select class="ddlSubcategory" id="ddlSubcategory" name="ddlSubcategory">';
		$data .='<option value="-select-" id="-select-">-Select-</option>';
		while ($dataz = mysql_fetch_array($run))
		{
			if(strlen($dataz['subcat_name'])>0)
			{
				$data .='<option value="'.$dataz['subcat_name'].'">'.ucfirst($dataz['subcat_name']).'</option>';
			}
		}
		$data .='</select>';
		echo $data;